﻿@model IList<COMCMS.Core.AdminMenu>
@{ 
    ViewBag.title = "后台菜单管理";
}
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>@ViewBag.title</h5>
        </div>
        <div class="ibox-content">
            <div id="toolbar" class="btn-group">
                <button id="btn_add" type="button" class="btn btn-outline btn-default" onclick="showDialog('addadminmenu','添加后台菜单','/AdminCP/Permission/AddAdminMenu',0,0);">
                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
                </button>
                <button id="btn_edit" type="button" class="btn btn-outline btn-default">
                    <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
                </button>
                <button id="btn_delete" type="button" class="btn btn-outline btn-default">
                    <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
                </button>

            </div>

            <div id="toolbar2" class="btn-group pull-right">
                <button id="btn_refresh" type="button" class="btn btn-outline btn-default" onclick="refresh();">
                    <span class="fa fa-refresh" aria-hidden="true"></span>刷新
                </button>
            </div>
            <table class="tree table table-striped table-bordered">
                <thead>
                    <tr>
                        <th>菜单名称</th>
                        <th>菜单Key</th>
                        <th class="text-center">排序</th>
                        <th>链接地址</th>
                        <th class="text-center">隐藏</th>
                        <th>权限详情</th>
                        <th>操作</th>
                    </tr>
                </thead>
                @if (Model.Count == 0)
                {
                    <tr><td colspan="7" class="text-center">暂无记录</td></tr>
                }
                @foreach (var m in Model)
                {
                    <tr class="treegrid-@m.Id @(m.PId !=0?"treegrid-parent-"+m.PId:"") ">
                        <td>
                            @if (!string.IsNullOrWhiteSpace(m.ClassName))
                            {
                                <i class="fa @m.ClassName"></i>
                            }
                            @m.MenuName
                        </td>
                        <td>@m.MenuKey</td>
                        <td class="text-center">@m.Rank</td>
                        <td>@m.Link</td>
                        <td class="text-center">
                            @if (m.IsHide == 1)
                            {
                                <i class="fa fa-eye-slash"></i>
                            }
                    </td>
                    <td>
                        @foreach (var e in @m.ListEvent)
                        {
                            <span>@e.EventName</span>
                        }

                    </td>
                    <td>
                        <a href="javascript:;" class="btn btn-xs btn-primary" title="编辑" onclick="top.showDialog('eidtadminmenu', '编辑后台菜单详情', '/AdminCP/Permission/EditAdminMenu/@m.Id', 0, 0)"><i class="fa fa-edit"></i> 编辑</a>
                        <a href="javascript:;" class="btn btn-xs btn-danger" title="删除" onclick="doDel('/AdminCP/Permission/DelAdminMenu',@m.Id);"><i class="fa fa-close"></i> 删除</a>
                    </td>
                </tr>
            }
            </table>
            <script type="text/javascript">
                $(document).ready(function () {
                    $('.tree').treegrid();
                });
            </script>
        </div>
    </div>


</div>